<template>
<el-drawer title="详情" :visible.sync="visible" :wrapperClosable="false"
           size="40%" append-to-body class="JNPF-common-drawer">
<div class="JNPF-flex-main">
<div class="dynamicForm dynamicDetail" >
<el-form ref="elForm" :model="dataForm" size="medium" label-width="120px" label-position="right" >
    <template v-if="!loading">
            <el-col :span="12" >
                <el-form-item  label="资产名称"  
 prop="assetName" >
                        <p>{{dataForm.assetName}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="抵押单位"  
 prop="mortgageUnit" >
                         <p>{{ dataForm.mortgageUnit | dynamicText(mortgageUnitOptions) }} </p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="抵押开始时间"  
 prop="mortgagePeriodStart" >
                        <p>{{jnpf.toDate(dataForm.mortgagePeriodStart,"yyyy-MM-dd")}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="抵押结束时间"  
 prop="mortgagePeriodEnd" >
                        <p>{{jnpf.toDate(dataForm.mortgagePeriodEnd,"yyyy-MM-dd")}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="备注"  
 prop="notes" >
                        <p>{{dataForm.notes}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="抵押附件"  
 prop="mortgageFile" >
                    <JNPF-UploadFz    v-model="dataForm.mortgageFile"
 disabled
 detailed  :showTip="true"  :fileSize="50"  sizeUnit="MB"  :limit="9"  buttonText="点击上传"  >
                </JNPF-UploadFz>
                </el-form-item>
            </el-col>
    </template>
</el-form>
    </div>
    <div class="drawer-footer">
        <el-button @click="visible = false"> 取 消</el-button>
    </div>
    </div>
    </el-drawer>
</template>
<script>
    import request from '@/utils/request'
    import PrintBrowse from '@/components/PrintBrowse'
    import jnpf from '@/utils/jnpf'
    export default {
        components: {PrintBrowse},
        props: [],
        data() {
            return {
                visible: false,
                loading: false,
                printBrowseVisible: false,
                printId: '',
            dataForm: {
                id :'',
                            assetName : "",
                            mortgageUnit : "",
                            mortgagePeriodStart : '',
                            mortgagePeriodEnd : '',
                            notes : '',
                            mortgageFile : [],
            },
                                mortgageUnitOptions:[{"fullName":"选项一","id":"1"},{"fullName":"选项二","id":"2"}],

        }
        },
        computed: {},
        watch: {},
        created() {

        },
        mounted() {},
        methods: {
            dataInfo(dataAll){
                let _dataAll =dataAll
                        _dataAll.mortgageUnit = _dataAll.mortgageUnit ? JSON.parse( _dataAll.mortgageUnit):[]
                        _dataAll.mortgageFile = _dataAll.mortgageFile ? JSON.parse( _dataAll.mortgageFile):[]
                this.dataForm = _dataAll
            },

            init(id) {
                this.dataForm.id = id || 0;
                this.visible = true;
                this.$nextTick(() => {
                    if(this.dataForm.id){
                        this.loading = true
                        request({
                            url: '/api/example/ZcglZcrzZcdy/detail/'+this.dataForm.id,
                            method: 'get'
                        }).then(res => {
                            this.dataInfo(res.data)
                            this.loading = false
                        })
                    }

                })
            },
        },
    }

</script>
